package com.javahash.spring.utils;


import java.util.Map;


public final class RateUtils {

    private RateUtils() {

    }


    //TODO use JodaMoney for convertions

    public static Double convertCurrency(String fromCurrency, String toCurrency, Double amount, Map<String, Double> exchangeRatesMap) {
        Double fromCurrencyRate = exchangeRatesMap.get(fromCurrency);
        Double toCurrencyRate = exchangeRatesMap.get(toCurrency);

        return ((toCurrencyRate / fromCurrencyRate) * amount);


    }


}
